#{extends 'main.html' /} #{set title:'UserView' /}
<head>

<!-- JAVA SCRIPT PARTIOTION START-->
<!--------------------------------->
<!-- ON PAGE LOADING HIDE ALL !! -->
<script type="text/javascript">
   	$(function(){
		javascript:showOrganizationsJoined();
		javascript:showOrganizationsFollowed();
		javascript:showOrganizationsManaged();
		javascript:showEntitsJoined();
		javascript:showEntitsFollowed();
		javascript:showEntitsManaged();
	});
</script>
<!-- ON PAGE LOADING HIDE ALL !! -->
<!--------------------------------->
<!----- Show / Hide divisions ----->
<script type="text/javascript">
    function showThisAndHideAll(divisionToShow){
		$('#organizationDiv').hide();
		$('#entityDiv').hide();
		$('#topicDiv').hide();   
		$('#ideaDiv').hide();		
		$('#'+divisionToShow+'Div').slideDown(1000);
	}
</script>
<!----- Show / Hide divisions ----->
<script type="text/javascript">
    function showThisAndHideAllOrg(divisionToShow){
		$('#joinedOrgsDiv').hide();
		$('#managedOrgsDiv').hide();
		$('#followedOrgsDiv').hide();
		$('#'+divisionToShow+'Div').slideDown(1000);
	}
</script>
<!--------------------------------->
<!----- Show / Hide hyper Links --->
<script type="text/javascript">
    function changeLabelAndHyperLinks(division,link){
		if(division == "organization"){
			if(link == "joinedOrganizations"){
			} else if(link == "managedOrganizations"){
			} else if(link == "myOrganizations"){
				javascript:showOrganizationsFollowed();
			}
		}
		if(division == "entity"){
		}
		if(division == "topic"){
		}
		if(division == "idea"){
		}
	}
</script>
<!----- Show / Hide hyper Links --->
<!--------------------------------->

<script type="text/javascript">
    function showOrganizationsJoined(){
    	var user = '${user}';
 	    $.getJSON('@{BrowseController.browseOrganizationsJoined()}',{'userName': user}, function(data){
 	    var orgs = data.joinedOrgs;
        var orgsPart = "";
        
    	if(orgs == null || orgs == ""){	
		document.getElementById("joinedOrgsDiv").innerHTML = "No organizations to show";
		} else {
		orgsPart = "";
		var x = orgs.split("&&");
		for(var i = 0; i<x.length; i = i+1){
		//orgsPart +=	"<tr> <td><a href = '#' onclick = \"showOrganization('" + "" + user + "','" + x[i] +"')\">" +   "open"+  "</a>";	
        orgsPart += "<tr> <td> <a href = '#' onclick = \"getInsideOrg('" + "" + user + "','" + x[i] +"')\">" +   x[i]+  "</a></tr></td></br>";
        //orgsPart += "<div id = \"org" + x[i] + "\"></div></td><td>" + "votes" + "</td></tr>";
		}
		document.getElementById("joinedOrgsDiv").innerHTML = orgsPart;
   		}
    });
    }
</script>

<script type="text/javascript">
    function showOrganizationsManaged(){
    	var user = '${user}';
 	    $.getJSON('@{BrowseController.browseOrganizationsManaged()}',{'userName': user}, function(data){
 	   	var orgs = data.managedOrgs;
        var orgsPart = "";
    	if(orgs == null || orgs == ""){	
		document.getElementById("managedOrgsDiv").innerHTML = "No organizations to show";
		} else {
		orgsPart = "";
		var x = orgs.split("&&");
		for(var i = 0; i<x.length; i = i+1){
		//orgsPart +=	"<tr> <td><a href = '#' onclick = \"showOrganization('" + "" + user + "','" + x[i] +"')\">" +   "open"+  "</a>";	
        orgsPart += "<tr> <td> <a href = '#' onclick = \"getInsideOrg('" + "" + user + "','" + x[i] +"')\">" +   x[i]+  "</a></tr></td></br>";
        //orgsPart += "<div id = \"org" + x[i] + "\"></div></td><td>" + "votes" + "</td></tr>";
		}
		document.getElementById("managedOrgsDiv").innerHTML = orgsPart;
   		}
    });
    }
</script>

<script type="text/javascript">
    function showOrganizationsFollowed(){
    	var user = '${user}';
 	    $.getJSON('@{BrowseController.browseOrganizationsFollowed()}',{'userName': user}, function(data){
 	   	var orgs = data.followedOrgs;
        var orgsPart = "";
    	if(orgs == null || orgs == ""){	
		document.getElementById("followedOrgsDiv").innerHTML = "No organizations to show";
		} else {
		orgsPart = "";
		var x = orgs.split("&&");
		for(var i = 0; i<x.length; i = i+1){
		//orgsPart +=	"<tr> <td><a href = '#' onclick = \"showOrganization('" + "" + user + "','" + x[i] +"')\">" +   "open"+  "</a>";	
        orgsPart += "<tr> <td> <a href = '#' onclick = \"getInsideOrg('" + "" + user + "','" + x[i] +"')\">" +   x[i]+  "</a></tr></td></br>";
        //orgsPart += "<div id = \"org" + x[i] + "\"></div></td><td>" + "votes" + "</td></tr>";
		}
		document.getElementById("followedOrgsDiv").innerHTML = orgsPart;
   		}
    });
    }
</script>
<!-- ------------------------------------------------------------------------------------------------------------------------------------>
<!-- ------------------------------------------------------------Entities---------------------------------------------------------------->
<script type="text/javascript">
	function showEntitsJoined() {
		var user = '${user}';
		$
				.getJSON(
						'@{BrowseController.browseJoinedEntities()}',
						{
							'userName' : user
						},
						function(data) {
							var entits = data.joinedEntits;
							var entitsPart = "";
							if (entits == null || entits == "") {
								document.getElementById("joinedEntitsDiv").innerHTML = "Joined Entities</br>No entities to show";
							} else {
								entitsPart = "";
								var x = entits.split("&&");
								for ( var i = 0; i < x.length - 1; i = i + 1) {
									entitsPart += "<a href = '#' onclick = \"showEntity('"
											+ ""
											+ user
											+ "','"
											+ x[i]
											+ "')\">" + x[i] + "</a>";
								}
								document.getElementById("joinedEntitsDiv").innerHTML = "Joined Entities</br>" + entitsPart;
							}
						});
	}
</script>

<script type="text/javascript">
	function showEntitsManaged() {
		var user = '${user}';
		$
				.getJSON(
						'@{BrowseController.browseManagedEntities()}',
						{
							'userName' : user
						},
						function(data) {
							var entits = data.managedEntits;
							var entitsPart = "";
							if (entits == null || entits == "") {
								document.getElementById("managedEntitsDiv").innerHTML = "Managed Entities</br>No entities to show";
							} else {
								entitsPart = "";
								var x = entits.split("&&");
								for ( var i = 0; i < x.length - 1; i = i + 1) {
									entitsPart += "<a href = '#' onclick = \"showEntity('"
											+ ""
											+ user
											+ "','"
											+ x[i]
											+ "')\">" +"</a>";
								}
								document.getElementById("managedEntitsDiv").innerHTML = "Managed Entits</br>" + entitsPart;
							}
						});
	}
</script>

<script type="text/javascript">
	function showEntitsFollowed() {
		var user = '${user}';
		$
				.getJSON(
						'@{BrowseController.browseFollowedEntities()}',
						{
							'userName' : user
						},
						function(data) {
							var entits = data.followedEntits;
							var entitsPart = "";
							if (entits == null || entits == "") {
								document.getElementById("followedEntitsDiv").innerHTML = "Followed Entities</br>No entities to show";
							} else {
								entitsPart = "";
								var x = entits.split("&&");
								for ( var i = 0; i < x.length - 1; i = i + 1) {
									entitsPart += "<a href = '#' onclick = \"showEntity('"
											+ ""
											+ user
											+ "','"
											+ x[i]
											+ "')\">" + x[i]+ "</a>";
								}
								document.getElementById("followedEntitsDiv").innerHTML = "Followed Entities</br>" + entitsPart;
							}
						});
	}
</script>



<!-- JAVA SCRIPT PARTIOTION END -->

</head>

<!-- ------------------------------------------------------------------------------------------------------------------------------------>
<!-- ------------------------------------------------------------Topic------------------------------------------------------------------->





<body>
<div id="body">
			<div id="content">
				<table width="200" border="1">
					<tr>
						<th scope="col"><input type="button" id="organizationBtn"
							value="Organizations "
							onclick="showThisAndHideAll('organization')">
						</th>
						<th scope="col"><input type="button" id="entityBtn"
							value="   Entities   " onclick="showThisAndHideAll('entity')">
						</th>
						<th scope="col"><input type="button" id="topicBtn"
							value="    Topics    " onclick="showThisAndHideAll('topic')">
						</th>
						<th scope="col"><input type="button" id="ideaBtn"
							value="    Ideas     " onclick="showThisAndHideAll('idea')">
						</th>
						<th scope="col"><input type="button" id="button5"
							value="button5" onclick="lesa mata3mlsh 7aga">
						</th>
						<th scope="col"><input type="button" id="button6"
							value="button6" onclick="lesa mata3mlsh 7aga">
						</th>
					</tr>
				</table>

				<!---------------------------------------------------------->
				<!-- ORGANIZATION ORGANIZATION ORGANIZATION ORGANIZATION  -->
				<div id="organizationDiv">
					<table width="200" border="1">
						<tr>
							<td width="70%"><label id="labelOrganizations">My
									Organizations</label>
							</td>
							<td width="30%"><a href='#' id="joinedOrganizations"
								onclick="showThisAndHideAllOrg('joinedOrgs')">Joined</a>|
								<a href='#' id="managedOrganizations"
								onclick="showThisAndHideAllOrg('managedOrgs')">Managed</a>|
								<a href='#' id="myOrganizations"
								onclick="showThisAndHideAllOrg('followedOrgs')">Followed</a>
							</td>
						</tr>
					</table>
					
					
				</div>
				<!-- ORGANIZATION ORGANIZATION ORGANIZATION ORGANIZATION  -->
				<!---------------------------------------------------------->
				<!--ENTITIES ENTITIES ENTITIES ENTITIES ENTITIES ENTITIES -->
				<div id="entityDiv">
					<table width="200" border="1">
						<tr>
							<td width="70%">Most active</td>
							<td width="30%"><a href='#'>Most visited</a>| <a href='#'>Most
									Rated</a>
							</td>
						</tr>
					</table>
					<div>
						<table id="entitiesListDiv">
							<tr>
								<td>Entity 1</td>
								<td><a href='#'>Votes</a>| <a href='#'>Views</a>
								</td>
							</tr>
						</table>
					</div>
				</div>
				<!--ENTITIES ENTITIES ENTITIES ENTITIES ENTITIES ENTITIES  -->
				<!----------------------------------------------------------->
				<!--TOPICS TOPICS TOPICS TOPICS TOPICS TOPICS TOPICS TOPICS-->
				<div id="topicDiv">
					<table width="200" border="1">
						<tr>
							<td width="70%">Most active</td>
							<td width="30%"><a href='#'>Most visited</a>| <a href='#'>Most
									Rated</a>
							</td>
						</tr>
					</table>
					<div>
						<table id="topicListDiv">
							<tr>
								<td>Topic 1</td>
								<td><a href='#'>Votes</a>| <a href='#'>Views</a>
								</td>
							</tr>
						</table>
					</div>
				</div>

				<!--TOPICS TOPICS TOPICS TOPICS TOPICS TOPICS TOPICS TOPICS-->
				<!----------------------------------------------------------->
				<!--  IDEA IDEA IDEA IDEA IDEA IDEA IDEA IDEA IDEA IDEA    -->
				<div id="ideaDiv">
					<table width="200" border="1">
						<tr>
							<td width="70%">Most active</td>
							<td width="30%"><a href='#'>Most visited</a>| <a href='#'>Most
									Rated</a>
							</td>
						</tr>
					</table>
					<div>
						<table id="ideaListDiv">
							<tr>
								<td>Idea 1</td>
								<td><a href='#'>Votes</a>| <a href='#'>Views</a>
								</td>
							</tr>
						</table>
					</div>
				</div>
				<!--  IDEA IDEA IDEA IDEA IDEA IDEA IDEA IDEA IDEA IDEA   -->
				<!---------------------------------------------------------->
				<p>&nbsp;</p>


			</div>
			<div class="sidebar">
				<ul>
					<li>
						<h4>Tag Cloud</h4>
						<ul>
							<li>
								<p style="margin: 0;">place the tag cloud here !</p>
							</li>
						</ul>
					</li>
					<li>
						<h4>Search</h4>
						<ul>
							<li>
								<form method="get" class="searchform"
									action="http://wpdemo.justfreetemplates.com/">
									<p>
										<input type="text" size="24" value="" name="s2" class="s" />
										<input type="submit" class="searchsubmit formbutton"
											value="Search" />
									</p>
								</form>
							</li>
						</ul>
					</li>
					<li>-bta3t sharif el gnb el notification a7la !!
						<h4>Friend List :</h4>
						<ul>
							<li><a href='#' title="friend 1"><strong>friend
										1</strong> </a></li>
							<li><a href='#' title="friend 3"><strong>friend
										3</strong> </a></li>
							<li><a href='#' title="friend 2"><strong>friend
										2</strong> </a></li>
						</ul>
					</li>
				</ul>
			</div>
			<div class="clear"></div>
		</div>
		
		<div>
					<div id="joinedEntitsDiv"></div>
						<div id="followedEntitsDiv"></div>
						<div id="managedEntitsDiv"></div>
					</div>
					
					<div>
					<div id="joinedOrgsDiv"></div>
						<div id="followedOrgsDiv"></div>
						<div id="managedOrgsDiv"></div>
					</div>
</body>
